package com.sp.action.base;

import java.util.ArrayList;
import java.util.List;

import com.opensymphony.xwork2.ActionSupport;
/**
 * 分页查询的基类
 * @author Mo
 *
 */
@SuppressWarnings("serial")
public abstract class BaseJsonPageAction<T> extends ActionSupport {
	protected int totalPage = 0;
	protected int start = 0;
	protected int limit = 0;
	protected List<T> resultModel = new ArrayList<T>();
	
	//抽象查询结果
	protected abstract List<T> listResultModel(int start,int length);
	//抽象查询总的记录
	protected abstract int queryTotal();
	
	public void reflashResultModel(){
		this.resultModel = listResultModel(start, limit);
		this.totalPage = queryTotal();
	}
	
	public abstract int getTotalPage();
	public void setTotalPage(int totalPage) {
		this.totalPage = totalPage;
	}
	public int getStart() {
		return start;
	}
	public void setStart(int start) {
		this.start = start;
	}
	public int getLimit() {
		return limit;
	}
	public void setLimit(int limit) {
		this.limit = limit;
	}
	public abstract List<T> getResultModel();
	public void setResultModel(List<T> resultModel) {
		this.resultModel = resultModel;
	}
}
